#include <Chance.h>

Chance::Chance(double random):random_m(random)
{}

Chance& Chance::operator=(const Chance & chance)
{
    random_m = chance.random_m;
    return *this;
}

Chance& Chance::operator+(const Chance & chance)
{
	random_m = 1-(1-random_m)*(1-chance.random_m);
	return *this;
}

Chance& Chance::operator*(const Chance & chance)
{
	random_m = random_m*chance.random_m;
	return *this;
}

Chance& Chance::operator!(void)
{
	random_m = 1-random_m;
	return *this;
}

bool Chance::operator==(const Chance & chance) const
{
	return (-0.000001 <=(random_m - chance.random_m)&&(random_m-chance.random_m) <= 0.000001);
}
